export interface CarouselListType {
  carousel_name: string
  carousel_order: number
  carousel_img: string
  click_count: number
  carousel_url: string
  id: number
}

export const carouselColumns = (h) => [
  {
    title: "轮播图名称",
    align: 'center',
    key: "carousel_name"
  },
  {
    title: "轮播图",
    align: 'center',
    key: "carousel_img",
    render: (r:CarouselListType) => h(r, "carousel_img")
  },
  {
    title: "排序",
    align: 'center',
    key: "carousel_order",
    sortOrder: true,
    sorter (rowA, rowB) {
      console.log(rowA)
      console.log(rowB)
      return rowB.carousel_order - rowA.carousel_order
    }
  },
  {
    title: "点击数",
    align: 'center',
    key: "click_count"
  },
  {
    title: "链接地址",
    titleAlign: 'center',
    ellipsis: true,
    key: 'carousel_url',
  },
  {
    title: "操作",
    key: "id",
    align: 'center',
    render: (r:CarouselListType) => h(r)
  }
]


export interface CarouselSaveType {
  carousel_name: string
  carousel_order: number
  carousel_img: string
  carousel_url: string
}

export interface CarouselEditType extends CarouselSaveType {
  id: number | null
}
